<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" >
<head>
<title>Bất động sản</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<?php
	echo $this->Html->css('style');
	echo $this->Html->css('qtip');
	echo $this->Html->css('autocomplete/jquery.autocomplete');
	echo $this->Html->css('autocomplete/thickbox');
	//echo $this->Html->css('demo-auto/jquery.ui.all');
	//echo $this->Html->script('jquery.min.js');
	/*echo $this->Html->script('demo-auto/jquery.ui.core.js');
	echo $this->Html->script('demo-auto/jquery.ui.widget.js');
	echo $this->Html->script('demo-auto/jquery.ui.position.js');
	echo $this->Html->script('demo-auto/jquery.ui.autocomplete.js');*/
	echo $this->Html->script('autocomplete/jquery.js');
	echo $this->Html->script('autocomplete/jquery.bgiframe.min.js');
	echo $this->Html->script('autocomplete/jquery.ajaxQueue.js');
	echo $this->Html->script('autocomplete/thickbox-compressed.js');
	echo $this->Html->script('autocomplete/jquery.autocomplete.js');
	echo $this->Html->script('jquery.qtip-1.0.0-rc3.min.js');
	echo $this->Html->script('qtip/qtip.js');
	echo $this->Html->script('autogrow/jquery.autogrowtextarea.js');
	echo $this->Html->script('jquery.expander.js');
	echo $this->Html->script('validator/jquery.validate.js');
?>
<script type="text/javascript" src="http://www.google.com/recaptcha/api/js/recaptcha_ajax.js"></script> 
<script type="text/javascript">
	$(function() {
		function format(mail) {
			return mail.label;
		}
		$("#DuanField").autocomplete('<?php echo $this->webroot;?>/duans/autocomplete', {
			multiple: false,
			dataType: "json",
			parse: function(data) {
				return $.map(data, function(row) {
					return {
						data: row,
						value: row.value,
						result: row.label
					}
				});
			},
			formatItem: function(item) {
				return format(item);
			}
		}).result(function(e, item) {
			$("#idduan").val(item.id);
		});
	});
	$(document).ready(function(){
		$(".autogrow").autogrow();
		<?php $url = $this->webroot;?>
		install_qtip("<?php echo $url; ?>");
		$(".qtip-content").hide();	
		$(document).ready(function() { 
	      $("#PostFormClassified").validate({ 
				rules: { 
				  "tieude":"required",
				  "noidung":"required",
				  "tenlienhe":"required",
				  "sdtlienhe":"required",
				  "email":{
							required: true,
							email: true
						}
				}, 
				messages: { 
				  "tieude": "Nhập tiêu đề bài viết",
				  "noidung": "Nhập nội dung bài viết",
				  "tenlienhe": "Nhập tên liên hệ",
				  "sdtlienhe": "Nhập số điện thoại",
				  "email": {
						required: "Nhập email",
						email: "Nhập đúng định dạng mail"
				  }
				} 
	      }); 
	    });
	});
	var start = <?php echo $this->Session->read('start');?>;
	function view_more(){
		var desiredPosts = 2;
		$.ajax({
				url: '<?php echo $this->webroot;?>/duans/viewmorenormal',
				data: {
					'start': start,
					'desiredPosts': desiredPosts
				},
				type: 'get',
				beforeSend: function(){
					$('.image-loader-loadmore').css({display:'block'});
				},
				dataType: 'json',
				cache: false,
				success: function(json) {
					$('.image-loader-loadmore').css({display:'none'});
					for(i=0;i<json.length;i++){
						$(".list-projects-normal").append('<li>'+
								'<div class="content-project">'+
									'<a href="<?php echo $this->webroot;?>project-'+json[i].id+'.html"><img width="50" height="50" src="<?php echo $this->webroot;?>/app/webroot/upload/'+json[i].hinhdaidien+'" alt="'+json[i].tieude+'" title="'+json[i].tieude+'" /></a>'+
									'<ul>'+
										'<li class="title-project"><a href="<?php echo $this->webroot;?>project-'+json[i].id+'/'+(json[i].tieude).replace(/ /gi, "-")+'.html">'+json[i].tieude+'</a></li>'+
										'<li class="address-project">'+json[i].diachi+'</li>'+										
									'</ul>'+
									'<p class="content-more">'+
										json[i].noidung+
									'</p>'+
								'</div>'+
							'</li>');
					}
					$(".content-more").expander({
						slicePoint: 400,
						expandText: '',
						userCollapseText: ''
					});
					start+= desiredPosts;
					
				},
				//failure class
				error: function() {
					//reset the message
					//loadMore.text('Oops! Try Again.');
				},
				//complete event
				complete: function() {
					//remove the spinner
					//loadMore.removeClass('activate');
				}
			});
		
	}
</script>
</head>
<body>
      <div id="header">
            <div id="logo"><a href="<?php echo $this -> webroot;?>" title="Trang chủ"></a></div>
      </div>
   
      <div id="container">
            <div id="navcontainer">
				<div class="title-classifieds "><h1 class="underline">Tin rao</h1></div>
				<?php echo $this->element('tinraos-left'); ?>
            </div>
            
            <div id="content">
                  <div id="rightdiv">
                     
                        <div class="submitbox">
								<p><span class="subheading">Tìm kiếm </span></p>
								<?php
									echo $this->Form->create('Duan', array('action' => 'search'));
									echo $this->Form->input('idduan', array('label' => '', 'name' => 'idduan', 'id' => 'idduan', 'type' => 'hidden'));
									echo $this->Form->input('field', array('label' => ''));
									$options = array(
														'label' => 'Tìm kiếm',
														'div' => array(
																		'class' => 'search-button',
																		)
													);
									echo $this->Form->end($options);
								?>
								
									
                              <!--<form id="form2" action="action">
                                    <table>
                                          <tr>
                                                <td><input style="width: 127px;" type="text" name="name" /></td>
                                                <td style="width: 100px;"><button type="submit" style="float: right;">Submit</button></td>
                                          </tr>
                                    </table>
                              </form>-->
                        </div>
						
                        <?php echo $this->Html->image('photo.jpg', array('alt' => 'company location'))?>
                        <!--<img src="/img/photo.jpg" alt="company location" />-->
                        <br /><br />
                        
                        <div id="news">
                              <h1 class="underline">Tin rao</h1><?php echo $this->element('tinraos-right'); ?>
                        </div>
						<div id="form-add-tinrao">
							<?php echo $this->element('add-tinrao'); ?>
						</div>
                  </div>
                  
                  <div id="maincontent">
						<div class="projects-vip">
							<div class="title-project-vip">
								<span>Dự án VIP</span>
							</div>
							<?php echo $this->element('vip-projects'); ?>
						</div>
                        <div class="wrap-projects">
							<div class="title-project-vip">
								<span>Các dự án</span>
							</div>
							<ul class="list-projects list-projects-normal">
								
							</ul>
							<a href="#" onclick="view_more();return false;" class="loadmore">Xem thêm
							<img class="image-loader-loadmore" src="<?php echo $this -> webroot;?>img/ajax-loader.gif" style="display: none;position: absolute;left: 170px; opacity: 0.5;top: 7px;"/>
							</a>
						</div>
                  </div>
                  
            </div>
            
      </div>
     
      <div id="footer">
            <div id="footertextleft">                 
                  <a href="index.html">Home</a> |
                  <a href="index.html">About Us</a> |
                  <a href="index.html">Products</a> |
                  <a href="index.html">Services</a> |
                  <a href="index.html">Price Guide</a> |
                  <a href="index.html">Locations</a> |
                  <a href="index.html">Contact Us</a>
            </div>
            <div id="footertextright">       
                  Copyright &copy; 2011 Your Company Name<br />
                  <!-- PLEASE LEAVE THIS SECTION UNCHANGED -->
                  <a href="http://www.richlyn.co.uk" title="Web Design">Web Design</a> by <a href="http://www.richlyn.co.uk" title="Web Design">Richlyn Systems Ltd</a>
                  <!--END-->
				
            </div>
      
      </div>
      
<div style="text-align: center; font-size: 0.75em;">Design downloaded from <a href="http://www.freewebtemplates.com/">free website templates</a>.</div>
<script type="text/javascript">
	view_more();
</script>
</body>
</html>
